import { defineStore } from "pinia";

//地图绘制
const useDrawStore = defineStore({
    id: "drawStore",
    state: () => ({
        graphic: null,
    }),
    actions: {
        //设置正在编辑的地图对象
        setGraphic(_graphic) {
            this.graphic = _graphic;
        },

        //设置样式
        setStyle(style) {
            this.graphic.setStyle(style);
        },

        //删除
        delGraphic() {
            this.graphic && this.graphic.remove();
            this.graphic = null;
        },
    },
});

export default useDrawStore;
